package com.finger.gulimall.product.dao;

import com.finger.gulimall.product.entity.AttrAttrgroupRelationEntity;
import com.finger.gulimall.product.entity.AttrGroupEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.finger.gulimall.product.vo.SkuItemAttrGroupVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 属性分组
 *
 * @author finger
 * @email 909128695@qq.com
 * @date 2022-03-16 12:43:42
 */
@Mapper
public interface AttrGroupDao extends BaseMapper<AttrGroupEntity> {

    /**
     * 根据属性分组id和属性id的集合从属性分组关系中间表中删除属性分组和属性的关联关系
     *
     * @param preDelRelations
     */
    void deleteBatchEntitys(@Param("entitys") List<AttrAttrgroupRelationEntity> preDelRelations);

    /**
     * 根据分类id和商品的spuid查出属性名和属性分组封装好的集合，用于商品详情页的商品展示
     *
     * @param catalogId 分类id
     * @param spuId     商品spuid
     * @return List<SkuItemAttrGroupVo>
     */
    List<SkuItemAttrGroupVo> selectAttrGroupWithSpuId(@Param("catalogId") Long catalogId, @Param("spuId") Long spuId);
}
